package com.gewu.bluetoothflow.db

import androidx.room.*

@Dao
interface BaseDao<T> {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
     fun insertAll(list: List<T>)

    @Delete
     fun delete(element: T)

    @Delete
     fun deleteList(elements: List<T>)

    @Delete
     fun deleteSome(vararg elements: T)

    @Update
     fun update(element: T)

    @Update
     fun updateList(element: List<T>)

    /**
     * 插入列表
     * 返回自增id
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
     fun insertAllGenerateIds(list: List<T>): List<Long>

    /**
     * 插入单个记录 返回自增id
     */
    @Insert(onConflict = OnConflictStrategy.REPLACE)
     fun insertGenerateId(element: T): Long
}